﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Mozilla.Profiles;

namespace Mozilla.Collections
{
    /// <summary>
    /// THIS CLASS IS NOT USED AS THE ACTUAL ProfileCollection. 
    /// IT IS FOR USE STRICTLY WITH THE ProfilesEventArgs which 
    /// is fired when the profiles have been updated.
    /// </summary>
    public class ProfilesCollection : CollectionBase
    {
        internal int Add(Profile profile)
        {
            return List.Add(profile);
        }

        /// <summary>
        /// Performs a case sensitive search for a profile.
        /// </summary>
        /// <param name="ProfileName">The name of the profile.</param>
        /// <returns>A Profile if found, null otherwise.</returns>
        public Profile this[string ProfileName]
        {
            get
            {
                for (int i = 0; i <= List.Count - 1; i += 1)
                {
                    if (ProfileName == ((Profile)List[i]).Name)
                    {
                        return (Profile)List[i];
                    }
                }
                return null;
            }
        }
    }
}
